package com.liuche.book.auth.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Objects;

@Getter
@AllArgsConstructor
public enum LoginTypeEnum {
    // 验证码
    VERIFICATION_CODE(1, "手机验证码登录"),
    // 密码
    PASSWORD(2, "账号密码登录")
    ;

    private final Integer code;
    private final String desc;


    public static LoginTypeEnum valueOf(Integer code) {
        for (LoginTypeEnum loginTypeEnum : LoginTypeEnum.values()) {
            if (Objects.equals(code, loginTypeEnum.getCode())) {
                return loginTypeEnum;
            }
        }
        return null;
    }
}
